package com.hengpeng.itfin.persist.impl;

import java.util.List;

import org.springframework.stereotype.Repository;

import com.hengpeng.common.persist.AbstractDao;
import com.hengpeng.common.persist.query.DynamicQuery;
import com.hengpeng.itfin.persist.UserReferDao;
import com.hengpeng.itfinbase.persist.UserRefer;

@Repository
public class UserReferDaoImpl extends AbstractDao<UserRefer> implements UserReferDao {

    @Override
    public UserRefer getUserReferByToUserId(Long touserId) {
        DynamicQuery query = new DynamicQuery(UserRefer.class);
        query.eq("toUserId", touserId);
        return super.getSingleByDynamicQuery(query);
    }

    @Override
    public List<UserRefer> getUserReferByFromUserId(Long fromuserId) {
        DynamicQuery query = new DynamicQuery(UserRefer.class);
        query.eq("fromUserId", fromuserId);
        return super.findAllByDynamicQuery(query);
    }
}
